package com.itheima.mapper;

import com.itheima.pojo.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

/*
* 部门管理Mapper
* */
@Mapper
public interface DeptMapper {
    /*
    * 查询全部部门数据
    * */
    @Select("SELECT * from dept")
    List<Dept> list();

    /*
    * 根据id查询部门信息
    * */
    @Select("SELECT * from dept where id = #{id}")
    Dept getById(Integer id);

    /*
    * 根据id删除部门信息
    * */
    @Delete("DELETE from dept where id = #{id}")
    void deleteById(Integer id);


    @Insert("INSERT INTO dept(name,create_time,update_time) values(#{name},#{createTime},#{updateTime})")
    void insertDept(Dept dept);


    @Update("update dept set name = #{name} where id = #{id}")
    void updateDept(Dept dept);
}
